<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><%request.setAttribute("ctx", request.getContextPath()); %><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<meta content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=2.0; user-scalable=0;" name="viewport">
<link rel="stylesheet" type="text/css" href="${ctx}/front/login.css"/>
<script type="text/javascript" src="${ctx}/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="${ctx}/my/pub.js"></script>
<title>流量经营指标监控系统</title>   
</head>
<body>
<div class="title">
	<div class="big-title">流量经营指标监控系统</div>
	<div class="small-title">v0.8</div>
</div>
<form id="loginForm" method="post">
	<div class="name"><input class="fill-input"  name="account" id="account" type="text" value="admin" /></div>
	<div class="password"><input class="fill-input"  name="pwd" id="pwd" type="text" value="123456" /></div>
	<div class="botton-1"><input class="choose-input" name="remember" type="checkbox" value="1" />记住密码</div>
	<div class="botton-2"><input class="botton-input" name="land" type="button" value="登录" onclick="doLogin();"/></div>
</form>
</body>
</html>
<script language="javascript">
<!--
	var frameUrl="${ctx}/title!viewFrontMain.action";
	
	//自动调用初始化
	$(document).ready(function(){	
		checkToken();
	});
	
	//验证token
	function checkToken(){
		var url="${ctx}/sys!checkToken.action";
		$.post(url, null ,function callback(txt){  
			var json = $.parseJSON(txt);				
			if (json.code==0) {		
				location.href=frameUrl;					
			}
		}); 
	}

	//登录
	function doLogin() {
		if ($("#account").val()== ""){
			alert('帐号不能为空！');
			return;
		}
		if ($("#pwd").val() == ""){
			alert('密码不能为空！');
			return;
		}
		if ($("#pwd").val().length<6){
			alert('密码长度至少6位！');
			return;
		}		
		var url="${ctx}/sys!login.action";
		$.post(url, $("#loginForm").serialize() ,function callback(txt){  
				var json = $.parseJSON(txt);				
				if (json.code==0) {		
					location.href=frameUrl;					
				}else{
					alert('登录失败！请检查帐号或密码！');
				}
		}); 
	}
	
	//退出
	function closeWin() {
	    window.opener=null;
	    window.open('','_self');
	    window.close();
	}
	
	//--------------
	var a=document.getElementById("account");            
	a.onfocus = function(){
	    if( this.value == this.defaultValue ){
	        this.value = '';
	        this.style.color = '#292929';
	    }
	}
	a.onblur = function(){
	    if( this.value == '' || this.value == this.defaultValue ){
	        this.value = this.defaultValue;
	        this.style.color = '#999';
	    }
	} 		
	var b=document.getElementById("pwd");
	b.onfocus = function(){
	    if( this.value == this.defaultValue ){
	        this.value = '';
	        this.style.color = '#000';
	    }
	}
	b.onblur = function(){
	    if( this.value == '' || this.value == this.defaultValue ){
	        this.value = this.defaultValue;
	        this.style.color = '#999';
	    }
	}
//-->
</script>